<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arr = [1, 0, 2, 5, 8, 0, 3, 0, 4, 3, 0]
        function moveZero(arr) {
            var temp = []
            var count = 0
            for (var i = 0; i < arr.length; i++) {
                if (arr[i] != 0) {
                    temp[count] = arr[i]
                    count += 1
                }
            }
            console.log(temp);

        }

        moveZero(arr)
    </script>
</head>

<body>

</body>

</html>